package com.hl233.framework.thread;

/**
 * @author 张振强15065206763
 * @create 2024-09-06
 */
public class BreadConsumer implements Runnable {

    private final String name;

    public BreadConsumer(String name) {
        this.name = name;
    }


    @Override
    public void run() {
        while (true) {
//            try {
                //去商店购买面包
                String bread = BreadStore.take();
//                Thread.sleep(1000);
                System.out.println(name + "购买了" + bread + ":" + "面包");

//            } catch (InterruptedException e) {
//                throw new RuntimeException(e);
//            }

        }
    }
}
